
    <!DOCTYPE html>
    <html lang="zh-CN">
    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>课程表 - 学习卡片</title>
      <style>
        body { font-family: sans-serif; background-color: #f0f8ff; color: #333; display: flex; flex-direction: column; align-items: center; padding: 50px 20px; }
        .header h1 { font-size: 32px; }
        .grid-container { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; width: 100%; max-width: 1200px; }
        .card-container { perspective: 1200px; cursor: pointer; height: 250px; }
        .card { width: 100%; height: 100%; position: relative; transform-style: preserve-3d; transition: transform 0.7s; border-radius: 16px; box-shadow: 0 4px 16px rgba(0,0,0,0.08); }
        .card-container.flipped .card { transform: rotateY(180deg); }
        .card-face { position: absolute; width: 100%; height: 100%; backface-visibility: hidden; display: flex; flex-direction: column; box-sizing: border-box; border-radius: 16px; background-color: #fff; padding: 24px; }
        .card-back { background-color: #f0fff4; transform: rotateY(180deg); justify-content: space-between; }
        .card-category { font-size: 14px; color: #0052d9; margin-bottom: 8px; font-weight: 500; }
        .card-question { font-size: 20px; font-weight: 500; flex-grow: 1; display: flex; align-items: center; justify-content: center; text-align: center; }
        .card-answer-wrapper { flex-grow: 1; overflow-y: auto; }
        .card-answer { font-size: 15px; line-height: 1.7; }
        .card-footer { font-size: 13px; color: #8a919f; border-top: 1px solid #f0f0f0; padding-top: 16px; margin-top: 16px; }
        .card-source { font-size: 13px; color: #8a919f; border-top: 1px solid #f0f0f0; padding-top: 12px; margin-top: 12px; }
      </style>
    </head>
    <body>
      <div class="header">
        <h1>课程表 - 学习卡片</h1>
      </div>
      <div class="grid-container">
        
    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">理论</div>
          <div class="card-question">“课程表”问题在图论中本质上是在检测什么特性？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">理论</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">“课程表”问题本质上是在检测一个由课程和其先修关系构成的有向图中是否存在环。如果图中没有环，则意味着所有课程都可以完成学习。</div>
          </div>
          <div class="card-source">来源: 解题思路</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">算法</div>
          <div class="card-question">解决“课程表”问题时，文档中提到了哪两种核心算法？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">算法</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">文档中提到了两种核心算法：深度优先搜索（DFS）和广度优先搜索（BFS），其中BFS方法具体应用了拓扑排序。</div>
          </div>
          <div class="card-source">来源: 核心考点/算法</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">机制</div>
          <div class="card-question">使用BFS方法（拓扑排序）解决此问题的第一步是什么？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">机制</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">使用BFS方法的第一步是计算每个节点的入度（即每门课程的先修课程数量），然后找到所有入度为0的节点作为起始点放入队列中。</div>
          </div>
          <div class="card-source">来源: 解题思路</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">特性</div>
          <div class="card-question">文档中提到的DFS和BFS两种解法在时间和空间复杂度上有何异同？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">特性</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">根据文档，DFS和BFS两种解法的时间复杂度和空间复杂度是相同的。时间复杂度均为O(V + E)，空间复杂度均为O(V)，其中V是课程数，E是先修课程关系数。</div>
          </div>
          <div class="card-source">来源: 解题思路</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">技术</div>
          <div class="card-question">在提供的BFS示例代码中，`indegree`数组的作用是什么？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">技术</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">`indegree`数组用于记录每门课程的入度，即其拥有的先修课程数量。算法通过这个数组来识别哪些课程没有先修课程（入度为0），从而可以将它们作为拓扑排序的起始节点。</div>
          </div>
          <div class="card-source">来源: 示例代码</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">技术</div>
          <div class="card-question">在BFS示例代码的最后，是如何判断所有课程都能完成的？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">技术</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">代码通过一个计数器 `count` 记录成功完成拓扑排序的课程数量。在循环结束后，通过比较 `count` 是否等于总课程数 `numCourses` 来判断是否所有课程都能完成。如果相等，则说明可以完成。</div>
          </div>
          <div class="card-source">来源: 示例代码</div>
        </div>
      </div>
    </div>

      </div>
    </body>
    </html>
